package DDB.Ddc;

public class StringBuilderDemo {
    public static void main(String[] args) {
        String q = "啊对对对";
        StringBuilder builder = new StringBuilder(q);
        builder.append("，白给");
        System.out.println(builder);
        builder.replace(4,7,"是是是");
        System.out.println(builder);
        builder.delete(0,5);
        System.out.println(builder);
        builder.insert(0,"寄");
        System.out.println(builder);
        /*
        StringBuilder builder1 = new StringBuilder();
        StringBuilder builder2 = new StringBuilder("qqq");


        String s= "qqq";
        StringBuilder builder3 = new StringBuilder(s);
        String s1= builder3.toString();*/


































        /*String str = "好好学习Java";

            StringBuilder builder = new StringBuilder(str);


            builder.append("，为了找个好工作");
            System.out.println(builder);


            builder.replace(9,16,"就是为了改变世界");
            System.out.println(builder);


            builder.delete(0,8);
            System.out.println(builder);


            builder.insert(0,"活着");
            System.out.println(builder);

        /*
        //StringBuilder的创建方式:
        StringBuilder builder1 = new StringBuilder();
        StringBuilder builder2 = new StringBuilder("abc");

        //String和StringBuilder互转:
        String str = "abc";
        StringBuilder builder3 = new StringBuilder(str);
        String str2 = builder3.toString();

             */

        }
    }

